﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.Common;

namespace Sinacor.Servico.Bovespa.Ordens.Service.ServiceImplementation.Translator
{
    public class TranslateOrdemInconsistenciaToResponse : BaseTranslator<DataContract.Response.OrdemInconsistenciaResponse, BusinessEntity.OrdemInconsistencia,
                                                            List<DataContract.Response.OrdemInconsistenciaResponse>, List<BusinessEntity.OrdemInconsistencia>>
    {
        public override Sinacor.Servico.Bovespa.Ordens.Service.DataContract.Response.OrdemInconsistenciaResponse Translate(Sinacor.Servico.Bovespa.Ordens.BusinessEntity.OrdemInconsistencia from){
            if(from == null){
                return null;
            }

            DataContract.Response.OrdemInconsistenciaResponse to = new Sinacor.Servico.Bovespa.Ordens.Service.DataContract.Response.OrdemInconsistenciaResponse();

            to.DataOrdem = from.DataOrdem;
            to.DataPregao = from.DataPregao;
            to.DescricaoErro = from.DescricaoErro;
            to.NumeroOrdem = from.NumeroOrdem;
            to.NumeroOrdemSubSequencia = from.NumeroOrdemSubSequencia;
            to.ValorErro = from.ValorErro;

            return to;
        }
        
        public List<DataContract.Response.OrdemInconsistenciaResponse> Translate(List<BusinessEntity.OrdemInconsistencia> pListOrdemInconsistencia){
            List<DataContract.Response.OrdemInconsistenciaResponse> to = new List<Sinacor.Servico.Bovespa.Ordens.Service.DataContract.Response.OrdemInconsistenciaResponse>();

            for(int i=0; i<pListOrdemInconsistencia.Count; i++){
                to.Add(Translate(pListOrdemInconsistencia[i]));
            }

            return to;
        }
    }
}
